<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <title>Markdown 配置：自动空格/段落开头空两格/矫正术语/矫正标点/启用目录/禁用脚注/wysiwyg & ir 模式不渲染代码块/解析 settext/不过滤 XSS/主题/为列表添加标记 -
        Vditor</title>
    <meta name="robots" content="index,follow,archive">
    <meta name="description"
          content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
    <meta name="copyright" content="B3log"/>
    <link rel="canonical" href="https://vditor.b3log.org/demo/advanced-markdown.html">
    <link rel="apple-touch-icon" href="//static.b3log.org/images/brand/vditor-128.png">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="Window-target" content="_top"/>
    <link rel="icon" type="image/png" href="//static.b3log.org/images/brand/vditor-128.png"/>
    <link rel="shortcut icon" type="image/x-icon" href="//static.b3log.org/images/brand/vditor-512.png"/>
    <link type="text/css" rel="stylesheet" href="//static.b3log.org/css/base.css" charset="utf-8"/>

    <meta property="og:locale" content="zh_CN"/>
    <meta property="og:title"
          content="Markdown 配置：自动空格/段落开头空两格/矫正术语/矫正标点/启用目录/禁用脚注/wysiwyg & ir 模式不渲染代码块/解析 settext/不过滤 XSS/主题/为列表添加标记 - Vditor"/>
    <meta property="og:description"
          content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
    <meta property="og:image" content="https://static.b3log.org/images/brand/vditor-128.png"/>
    <meta property="og:url" content="https://vditor.b3log.org"/>
    <meta property="og:site_name" content="B3log"/>
    <meta name="twitter:card" content="summary_large_image"/>
    <meta name="twitter:description"
          content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
    <meta name="twitter:title"
          content="Markdown 配置：自动空格/段落开头空两格/矫正术语/矫正标点/启用目录/禁用脚注/wysiwyg & ir 模式不渲染代码块/解析 settext/不过滤 XSS/主题/为列表添加标记 - Vditor"/>
    <meta name="twitter:image" content="https://static.b3log.org/images/brand/vditor-128.png"/>
    <meta name="twitter:url" content="https://vditor.b3log.org"/>
    <meta name="twitter:site" content="@b3logos"/>
    <meta name="twitter:creator" content="@b3logos"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vditor@latest/dist/index.css"/>
    <script src="//vditor.b3log.org/vditor.js?v1.0.0" defer></script>
    <style>
        .header {
            background-color: #fff;
            box-shadow: rgba(0, 0, 0, 0.05) 0 1px 7px;
            border-bottom: 1px solid #e1e4e8;
        }

        .vditor-reset ul[data-style="+"] {
            list-style-type: "\2764";
        }

        .vditor-reset ul[data-style="+"] ul {
            list-style-type: "\1f49a"
        }

        .vditor-reset ul[data-style="+"] ul ul {
            list-style-type: "\1f49b"
        }

        .vditor-reset ul[data-style="-"] {
            list-style-type: korean-hangul-formal
        }

        .vditor-reset ul[data-style="-"] ul {
            list-style-type: decimal-leading-zero
        }

        .vditor-reset ul[data-style="-"] ul ul {
            list-style-type: lower-alpha
        }

        .vditor-reset ol[data-style="1)"] {
            list-style-type: simp-chinese-formal
        }

        .vditor-reset ol[data-style="1)"] ol {
            list-style-type: simp-chinese-informal
        }

        .vditor-reset ol[data-style="1)"] ol ol {
            list-style-type: trad-chinese-formal
        }
    </style>
</head>
<body>
<div class="header fn-clear">
    <a class="header-logo" href="https://vditor.b3log.org">
        <img src="//static.b3log.org/images/brand/vditor-128.png">
        <h1>Vditor</h1>
    </a>
    <div class="fn-clear">
        <a class="header-a" href="https://hacpai.com/tag/vditor" target="_blank">社区</a>
        <a class="header-a header-red" target="_blank" href="https://hacpai.com/article/1549638745630">API</a>
        <a class="header-a header-green current" href="index.html">Demo</a>
        <a class="header-a header-yellow" href="https://hacpai.com/sponsor" target="_blank">成为赞助者</a>
    </div>
</div>
<div class="wrapper">
    <div class="fn-50"></div>
    相关 <a href="https://hacpai.com/article/1549638745630#options-preview-markdown" target="_blank">API</a>：
    options.preview.markdown
    <div class="fn-50"></div>
    <div class="actions">
        <button class="btn btn--small" onclick="setConfig(this, 'autoSpace')">自动空格</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'paragraphBeginningSpace')">段落开头空两格</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'fixTermTypo')">矫正术语</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'chinesePunct')">矫正标点</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'toc')">启用目录</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'footnotes')">禁用脚注</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'codeBlockPreview')">wysiwyg & ir 模式不渲染代码块</button>
        &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'setext')">解析 settext</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'sanitize')">不过滤 XSS</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'theme-dark')">dark theme</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'theme-wechat')">wechat theme</button> &nbsp;
        <button class="btn btn--small" onclick="setConfig(this, 'listStyle')">为列表添加标记</button> &nbsp;
    </div>
    <div id="vditor"></div>
    <div id="vditorDemoCode" class="vditor-reset">
        <pre><code class="javascript">new Vditor('vditor', {
  height: 360,
  cache: {
    enable: false,
  },
  value: 'Markdown 配置',
})
</code></pre>
    </div>
    <div class="fn-100"></div>
    <div class="fn-clear">
        <h2 class="fn-left">参与讨论</h2>
        <span class="fn-right" style="line-height: 36px" id="commentCnt"></span>
    </div>
    <div class="fn-50"></div>
    <div id="vditorComments"></div>
    <div class="fn-100"></div>
</div>
<!-- end main -->

<div class="footer">
    <div class="wrapper fn-clear">
        <a href="https://b3log.org">首页</a> &nbsp; &nbsp;
        <a href="https://hacpai.com" target="_blank">社区</a> &nbsp; &nbsp;
        <a href="https://b3log.org/brand-marking.html">品牌标识</a> &nbsp; &nbsp;
        <a href="https://hacpai.com/sponsor" target="_blank">成为赞助者</a>
        <div class="fn-right">
            © 2010-present <a href="https://b3log.org">B3log 开源</a>旗下云南链滴科技有限公司
        </div>
    </div>
</div>
<script>
  const setConfig = (it, type) => {
    const value = `[toc]

# Vditor

一款浏览器端的markdown编辑器,支持所见即所得（富文本）、即时渲染（类似 Typora）和分屏预览模式.

# XSS

<img src="test" onerror="alert('XSS')">

# 列表

+ 所见即所得（wysiwyg）
    + 即时渲染（ir）
        + test

- 所见即所得（wysiwyg）
    - 即时渲染（ir）
      - 分屏预览（sv）

1) 所见即所得（wysiwyg）
    1) 即时渲染（ir）
        1) 分屏预览（sv）

脚注
===

这里是一个脚注引用[^1]，这里是另一个脚注引用[^bignote]。

\`\`\`javascript
new Vditor('vditor')
\`\`\`

[^1]: 第一个脚注定义。
[^bignote]: 脚注定义可使用多段内容。`

    document.getElementById('vditor').innerHTML = ''

    let config = {}
    config[type] = true
    if (type === 'footnotes' || type === 'codeBlockPreview' || type === 'sanitize') {
      config[type] = false
    }
    if (type && type.indexOf('theme') > -1) {
      config = {
        theme: type.split('-')[1],
      }
    }

    const options = {
      height: 360,
      theme: config.theme,
      mode: (type === 'paragraphBeginningSpace' || type === 'sanitize' || type === 'listStyle') ? 'sv' : 'wysiwyg',
      cache: {
        enable: false,
      },
      preview: {
        markdown: config,
      },
      value,
    }

    updateCode(it, `new Vditor('vditor', ${JSON.stringify(options, null, '  ').replace(/\\n/g, `
`).replace('<', '&lt;').replace(/`/g, '\\`').replace('"[', '`[').replace('。"', '。`')})`)
    new Vditor('vditor', options)
  }
  vditorScript = () => {
    new Vditor('vditor', {
      height: 360,
      cache: {
        enable: false,
      },
      value: 'Markdown 配置',
    })
  }
</script>
</body>
</html>
